
import { defineStore } from 'pinia'
import { ref } from 'vue'

// 定义 Store
export const useMemberStore = defineStore(
  'member',
  () => {
    // 会员信息
    const token = ref()
    const userId=ref("")
    const userName=ref("")
    const userInfo=ref()
    //危废登记部门数据
    const deptMap=ref([])
    //危险废物类别和所属部门的数据
    const typeAndDep=ref({})
   //申请转运中转运危废下的table别表
   const stateTable=reactive({
    columns: [
      { name: "wfTypeName", title: "类型", fixed: true },
      { name: "wfName", title: "名称" },
      { name: "wfWeight", title: "产出量" },
      { name: "wfUnit", title: "单位" },
      { name: "produceTime", title: "产出日期" },
      { name: "wfContainerType", title: "容器/包装类型" },
      { name: "wfTypeCode", title: "废物类别" },
      { name: "wfCreateCode", title: "危废代码" },
      { name: "wfTo", title: "去向" },
    ],
    rows: [],
    //我的申请中select_register_by_ids接口的数据
    temporaryData:[]
  })
  //首页中审批的数据
  const approval=ref({})
  // 我的申请点击每一条数据查看详情
  const ApplyViewing=ref({})
  //我的登记点击每一条数据查看详情
  const RegisterObjViewing=ref({})
  //查询中类型或部门中的已转运详情
  const QueryTransferDetails=ref({})
  //数据看板点击详情传递0或1
  const currentNub=ref(0)
  //按钮点击loading和disabled效果
  const boleanDisabled=ref(false)
  //tab页查询页面部门和类型的数据
  const searchLists=ref([])
  //pdf预览地址
  const srcURL=ref("")
    return {
      token,
      userId,
      userName,
      userInfo,
      deptMap,
      stateTable,
      approval,
      typeAndDep,
      ApplyViewing,
      RegisterObjViewing,
      currentNub,
      boleanDisabled,
      searchLists,
      QueryTransferDetails,
      srcURL
    }
  },
  {
    // 网页端配置
    // persist: true,
    // 小程序端配置
    persist: {
      storage: {
        getItem(key) {
          return uni.getStorageSync(key)
        },
        setItem(key, value) {
          uni.setStorageSync(key, value)
        },
      },
    },
  },
)
